package ai.zixing.singleton;

/**
 * 静态内部类方式
 */
public class Singleton_05 {

    private Singleton_05() {
//        if (SingletonHandler.instance != null) {
//            throw new RuntimeException("对象已存在");
//        }
    }

    private static class SingletonHandler{
        private static Singleton_05 instance = new Singleton_05();
    }

    public static synchronized Singleton_05 getInstance() {
        return SingletonHandler.instance;
    }
}
